"use strict";
const { app, BrowserWindow } = require("electron");
require("path");
const path = require("path");
function createWindow() {
  const win = new BrowserWindow({
    width: 1200,
    height: 800,
    webPreferences: {
      /* 是否启用Node integration. 默认值为 false. */
      nodeIntegration: true,
      preload: path.join(__dirname, "./preload.js"),
      /*  是否在独立 JavaScript 环境中运行 Electron */
      contextIsolation: true,
      devTools: true
    }
  });
  if (process.env.NODE_ENV === "development") {
    win.loadURL("http://localhost:5173/");
  } else {
    win.loadFile(path.join(__dirname, "../vue-dist/index.html"));
  }
}
app.whenReady().then(() => {
  createWindow();
  app.on("activate", () => {
    if (BrowserWindow.getAllWindows().length === 0) {
      createWindow();
    }
  });
});
app.on("window-all-closed", () => {
  if (process.platform !== "darwin") {
    app.quit();
  }
});
